﻿<r:RibbonWindow 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
    xmlns:Properties="clr-namespace:Thunder.IrcClient.Properties"
    xmlns:m="clr-namespace:Thunder.IrcClient"
    xmlns:AvalonDock="clr-namespace:AvalonDock;assembly=AvalonDock"
    x:Class="Thunder.IrcClient.MainWindow"
    x:Name="MyMainWindow"
    Height="600" 
    Width="800"  
    WindowStartupLocation="CenterScreen"
    Background="{DynamicResource WindowBackground}" 
    Icon="Content/Images/Ribbon/ProgramIcon.png" 
    Loaded="MainWindow_Loaded" 
    Initialized="MainWindow_Initialized" 
    Closing="MainWindow_Closing" 
    >

    <DockPanel>
        <r:Ribbon DockPanel.Dock="Top" Title="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=Title}">
            <r:Ribbon.Resources>

                <r:RibbonCommand x:Key="ChangeThemeMenu"
                    LabelTitle="Themes" 
                    LabelDescription="Select a theme to use"
                    LargeImageSource="Content/Images/Ribbon/Themes.png"
                    SmallImageSource="Content/Images/Ribbon/Themes.png" 
                />

                <r:RibbonCommand x:Key="ChangeThemeBlack"
                    Executed="ChangeThemeBlack_Execute"
                    LabelTitle="Black"
                    ToolTipTitle="Select the Black theme"
                    ToolTipDescription="This will replace the current theme with a Black theme"
                    LargeImageSource="Content/Images/Ribbon/Window.png"
                    SmallImageSource="Content/Images/Ribbon/Window.png" 
                />

                <r:RibbonCommand x:Key="ChangeThemeBlue"
                    Executed="ChangeThemeBlue_Execute"
                    LabelTitle="Blue"
                    ToolTipTitle="Select the Blue theme"
                    ToolTipDescription="This will replace the current theme with a Blue theme"
                    LargeImageSource="Content/Images/Ribbon/Window.png"
                    SmallImageSource="Content/Images/Ribbon/Window.png" 
                />

                <r:RibbonCommand x:Key="ChangeThemeSilver"
                    Executed="ChangeThemeSilver_Execute"
                    LabelTitle="Silver"
                    ToolTipTitle="Select the Silver theme"
                    ToolTipDescription="This will replace the current theme with a Silver theme"
                    LargeImageSource="Content/Images/Ribbon/Window.png"
                    SmallImageSource="Content/Images/Ribbon/Window.png" 
                />

                <r:RibbonCommand x:Key="ShowOptions" 
                                 Executed="ShowOptions_Execute"
                                 LabelTitle="Options"
                                 ToolTipTitle="Options"
                                 LabelDescription="Opens the Options dialog"
                                 ToolTipDescription="Opens the Options dialog"
                                 LargeImageSource="Content/Images/Ribbon/Config.png" 
                                 SmallImageSource="Content/Images/Ribbon/Config.png"
                 />

                <m:RibbonCommand x:Key="ConnectServer" 
                                 x:Name="ConnectServer"
                                 CommandName="ConnectServer"
                                 Executed="ConnectServer_Executed"
                                 CanExecute="ConnectServer_CanExecute"
                                 LabelTitle="Connect"
                                 ToolTipTitle="Connect"
                                 LabelDescription="Opens the Connection dialog"
                                 ToolTipDescription="Opens the Connection dialog"
                                 LargeImageSource="Content/Images/Ribbon/Login.png" 
                                 SmallImageSource="Content/Images/RibbonQuick/Login.png"
                />

                <m:RibbonCommand x:Key="Disconnect" 
                                 x:Name="Disconnect"
                                 CommandName="Disconnect"
                                 CanExecute="Disconnect_CanExecute"
                                 Executed="Disconnect_Executed"
                                 LabelTitle="Disconnect"
                                 ToolTipTitle="Disconnect"
                                 LabelDescription="Closes the current connection"
                                 ToolTipDescription="Closes the current connection"
                                 LargeImageSource="Content/Images/Ribbon/Logout.png" 
                                 SmallImageSource="Content/Images/RibbonQuick/Logout.png"
                />

                <m:RibbonCommand x:Key="QuickConnect" 
                                 x:Name="QuickConnect"
                                 CommandName="QuickConnect"
                                 CanExecute="QuickConnect_CanExecute"
                                 Executed="QuickConnect_Executed"
                                 LabelTitle="Quick Connect"
                                 ToolTipTitle="Quick Connect"
                                 LabelDescription="Connects to the last coneccted server"
                                 ToolTipDescription="Connects to the last coneccted server"
                                 LargeImageSource="Content/Images/Ribbon/QuickConnect.png" 
                                 SmallImageSource="Content/Images/RibbonQuick/QuickConnect.png"
                />

                <r:RibbonCommand x:Key="ShowChannelsCommand"
                                 LabelTitle="Channels"
                />

                <r:RibbonCommand x:Key="GetChannelListCommand"
                                 Executed="GetChannelList_Execute"
                                 CanExecute="GetChannelList_CanExecute"
                                 LabelTitle="Get Channels"
                                 ToolTipTitle="Gets the list of channels from the server"
                                 ToolTipDescription="Gets the list of channels from the server"
                />

                <r:RibbonGroupSizeDefinitionCollection x:Key="RibbonLayout">
                    <r:RibbonGroupSizeDefinition>
                        <!-- Control sizes: L,L,L -->
                        <r:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                        <r:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                        <r:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                    </r:RibbonGroupSizeDefinition>
                    <r:RibbonGroupSizeDefinition>
                        <!-- Control sizes: L,M,M -->
                        <r:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                        <r:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True"/>
                        <r:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True"/>
                    </r:RibbonGroupSizeDefinition>
                    <r:RibbonGroupSizeDefinition>
                        <!-- Control sizes: L,S,S -->
                        <r:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                        <r:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="False"/>
                        <r:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="False"/>
                    </r:RibbonGroupSizeDefinition>
                    <!-- Collapsed -->
                    <r:RibbonGroupSizeDefinition IsCollapsed="True" />
                </r:RibbonGroupSizeDefinitionCollection>
            </r:Ribbon.Resources>

            <!-- Define the application icon in the org -->
            <r:Ribbon.ApplicationMenu>
                <r:RibbonApplicationMenu>
                    <r:RibbonApplicationMenu.Command>
                        <r:RibbonCommand 
                            Executed="Application_Close"
                            LabelTitle="Application Button"
                            SmallImageSource="Content/Images/Ribbon/ProgramIcon.png"
                            LargeImageSource="Content/Images/Ribbon/ProgramIcon.png"
                            LabelDescription="Close the application."
                            ToolTipTitle="ThunderIrc Client"
                            ToolTipDescription="Opens the ThunderIrc Application menu" />
                    </r:RibbonApplicationMenu.Command>
                    <r:RibbonApplicationMenuItem>
                        <r:RibbonApplicationMenuItem.Command>
                            <r:RibbonCommand 
                                LabelTitle="_Close" 
                                LabelDescription="Close the Application"
                                Executed="Application_Close" />
                        </r:RibbonApplicationMenuItem.Command>
                    </r:RibbonApplicationMenuItem>
                </r:RibbonApplicationMenu>
            </r:Ribbon.ApplicationMenu>

            <!-- Quick pick menu -->
            <r:Ribbon.QuickAccessToolBar>
                <r:RibbonQuickAccessToolBar CanUserCustomize="True">
                    <r:RibbonButton Command="{StaticResource ConnectServer}" r:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar" />
                    <r:RibbonButton Command="{StaticResource Disconnect}" r:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar" />
                    <r:RibbonButton Command="{StaticResource QuickConnect}" r:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar" />
                </r:RibbonQuickAccessToolBar>
            </r:Ribbon.QuickAccessToolBar>

            <r:RibbonTab Label="General">

                <!-- Define the groups in this tab -->
                <r:RibbonTab.Groups>

                    <!-- Clipboard commands -->
                    <r:RibbonGroup GroupSizeDefinitions="{StaticResource RibbonLayout}">
                        <r:RibbonGroup.Command>
                            <r:RibbonCommand LabelTitle="Clipboard"  />
                        </r:RibbonGroup.Command>
                    </r:RibbonGroup>

                    <r:RibbonGroup GroupSizeDefinitions="{StaticResource RibbonLayout}">
                        <r:RibbonGroup.Command>
                            <r:RibbonCommand LabelTitle="Connection"  />
                        </r:RibbonGroup.Command>
                        <r:RibbonButton Command="{StaticResource ConnectServer}"/>
                        <r:RibbonButton Command="{StaticResource Disconnect}"/>
                        <r:RibbonButton Command="{StaticResource QuickConnect}"/>
                    </r:RibbonGroup>

                    <r:RibbonGroup GroupSizeDefinitions="{StaticResource RibbonLayout}">
                        <r:RibbonGroup.Command>
                            <r:RibbonCommand LabelTitle="Channels" />
                        </r:RibbonGroup.Command>

                        <r:RibbonTextBox TextDecorations="None" />
                        <r:RibbonButton x:Name="GetChannelList" Command="{StaticResource GetChannelListCommand}" />
                    </r:RibbonGroup>

                    <r:RibbonGroup GroupSizeDefinitions="{StaticResource RibbonLayout}">
                        <r:RibbonGroup.Command>
                            <r:RibbonCommand LabelTitle="Windows" />
                        </r:RibbonGroup.Command>
                        <r:RibbonCheckBox Command="{StaticResource ShowChannelsCommand}" x:Name="ShowChannelsOption" IsChecked="{Binding IsVisible, ElementName=ChannelsContent}"></r:RibbonCheckBox>
                    </r:RibbonGroup>

                    <r:RibbonGroup GroupSizeDefinitions="{StaticResource RibbonLayout}">
                        <r:RibbonGroup.Command>
                            <r:RibbonCommand LabelTitle="Tools"  />
                        </r:RibbonGroup.Command>

                        <r:RibbonDropDownButton Command="{StaticResource ChangeThemeMenu}">
                            <MenuItem Header="Black" Command="{StaticResource ChangeThemeBlack}"/>
                            <MenuItem Header="Blue" Command="{StaticResource ChangeThemeBlue}"/>
                            <MenuItem Header="Silver" Command="{StaticResource ChangeThemeSilver}"/>
                        </r:RibbonDropDownButton>

                        <r:RibbonButton Command="{StaticResource ShowOptions}"/>
                    </r:RibbonGroup>

                </r:RibbonTab.Groups>
            </r:RibbonTab>
        </r:Ribbon>

        <StatusBar DockPanel.Dock="Bottom" 
                   BorderBrush="SteelBlue" BorderThickness="0,1,0,0">
            <StatusBarItem DockPanel.Dock="Right" HorizontalAlignment="Right">
                <StackPanel Margin="5" Orientation="Horizontal">
                    <TextBlock Margin="5,0"  Text="Connection Status:" FontWeight="Bold" />
                    <TextBlock Name="StatusConnectionStatus" Text="{Binding ConnectionState, ElementName=MyMainWindow}" />
                </StackPanel>
            </StatusBarItem>
            <StatusBarItem DockPanel.Dock="Left" HorizontalAlignment="Left">
                <StackPanel Margin="5" Orientation="Horizontal">
                    <TextBlock Margin="5,0"  Text="Nick:" FontWeight="Bold" />
                    <TextBlock Text="{Binding Source={x:Static Properties:Settings.Default}, Path=Nick, Mode=OneWay}"  />
                </StackPanel>
            </StatusBarItem>
        </StatusBar>
        <Grid>
            <Grid>
                <AvalonDock:DockingManager x:Name="dockManager" Margin="0,0,0,25" Opacity="0.65" Loaded="DockingManager_Loaded">
                    <AvalonDock:ResizingPanel Orientation="Horizontal" x:Name="ResizingPanel">
                        <AvalonDock:DocumentPane x:Name="documentsHost">
                            <AvalonDock:DocumentContent Title="Status" x:Name="DocumetnContent">
                                <RichTextBox Name="StatusText" IsDocumentEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" Margin="0" BorderThickness="0" GotFocus="RichTextBox_GotFocus">
                                    <FlowDocument FontFamily="Lucida Console" 
                                                  FontSize="16" 
   	                                              TextAlignment="Left" 
	                                              LineHeight="Auto" 
	                                              IsHyphenationEnabled="False" 
	                                              xml:lang="en-us" 
                                                  FlowDirection="LeftToRight"
                                                  >
                                            <Paragraph Margin="0,0,0,0">
                                                <Run>Please visit</Run>
                                                <m:ThunderHyperlink>
                                                    <m:ThunderHyperlink.NavigateUri>http://thunderirc.codeplex.com</m:ThunderHyperlink.NavigateUri>
                                                    http://thunderirc.codeplex.com
                                                </m:ThunderHyperlink>
                                                <Run>for more information and updates</Run>
                                            </Paragraph>
                                        <Paragraph></Paragraph>
                                    </FlowDocument>
                                </RichTextBox>
                            </AvalonDock:DocumentContent >
                        </AvalonDock:DocumentPane>
                        <AvalonDock:DockablePane x:Name="DockablePane">
                            <AvalonDock:DockableContent Title="Members" x:Name="MembersContent">
                                <TreeView x:Name="MemberList"></TreeView>
                            </AvalonDock:DockableContent>
                            <AvalonDock:DockableContent Title="Channels" x:Name="ChannelsContent">
                                <TreeView x:Name="ChannelList"></TreeView>
                            </AvalonDock:DockableContent>
                        </AvalonDock:DockablePane>
                    </AvalonDock:ResizingPanel>
                </AvalonDock:DockingManager>
                <TextBox FontFamily="Consolas" Name="InputText" KeyDown="InputText_KeyDown" AcceptsReturn="False" AcceptsTab="False" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Hidden" RenderTransformOrigin="0.509,0.544" Height="25" VerticalAlignment="Bottom" Opacity="0.65" TabIndex="-10000" />
            </Grid>
        </Grid>
    </DockPanel>
</r:RibbonWindow>
